<div id = '<?php echo $id_pre?>_up_form'>
	<?php echo $this->Html->script(array('Album.jquery-ajaxfileupload'));?>
	<?php 
	if (isset($album_id)&&$album_id) {
		echo $this->Form->input('album_id',array('class'=>'album_id','type'=>'hidden','value'=>$album_id));
	}else{
		echo $this->Form->input('album_id',array('options'=>$albumList,'class'=>'album_id','id'=>false)); 
	}
	?>
	<input id = '<?php echo $id_pre?>uploadFile' name = 'data[AlbumPic][file]' type = 'file' onchange = '<?php echo $id_pre?>_ajaxupload.upload();'/>
	<div class = 'preivew'>
		<a href = "javascript:;" class = 'pic_select' 
			data-id =""
			data-link =""
			title="">
			<?php echo $this->Html->image('Album.nopic.jpg')?>
		</a>
	</div>
</div>

<input type = 'hidden' class = 'pic_id'/>
<input type = 'hidden' class = 'pic_link'/>
<input type = 'hidden' class = 'pic_ext'/>

<script type="text/javascript">
<?php echo $id_pre?>_ajaxupload = {};
<?php echo $id_pre?>_ajaxupload.upload = function(){
	var albumId = jQuery('#<?php echo $id_pre?>_up_form .album_id').val();
	jQuery.ajaxFileUpload({
		url:GM.RootScript+'/album/AlbumPics/ajaxPicUpload/'+albumId,
		secureuri:false,
		fileElementId:'<?php echo $id_pre?>uploadFile',
		dataType: 'json',
		success: function (data, status){
			var showtip =false;
			if(data.state){
				var link = GM.RootScript+'/img/'+data.msg+'.100x100.'+data.data.photo.ext;
				jQuery('#<?php echo $id_pre?>_up_form .preivew').show().find('img').attr('src',link);
				jQuery('#<?php echo $id_pre?> .pic_id').val(data.data.AlbumPic.id);
				jQuery('#<?php echo $id_pre?> .pic_link').val(data.msg);
				jQuery('#<?php echo $id_pre?> .pic_ext').val(data.data.photo.ext);
			} else {
				GM.tip(data.msg,false);
			}
		},
		error: function (data, status, e){
			GM.tip(status,false);
		}
	}
	);
};
</script>